﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Possan.IOC.Tests
{
	class TestPlug4 : IPlug4
	{
		int _dummy = -1;
		IPlug1 _plug1 = null;
		IPlug2 _plug2 = null;

		public TestPlug4()
		{
			Console.WriteLine("TestPlug4::TestPlug4() called.");
			_dummy = 0;
		}

		public TestPlug4(IPlug1 p1)
		{
			Console.WriteLine("TestPlug4::TestPlug4( IPlug1=" + p1 + " ) called.");
			_dummy = 0;
			if (p1 != null)
				_dummy++;
			_plug1 = p1;
		}

		public TestPlug4(IPlug2 p2, IPlug1 p1)
		{
			Console.WriteLine("TestPlug4::TestPlug4( IPlug2=" + p2 + ", IPlug1=" + p1 + " ) called.");
			_dummy = 0;
			if (p1 != null)
				_dummy++;
			if (p2 != null)
				_dummy++;
			_plug1 = p1;
			_plug2 = p2;
		}


		#region IPlug4 Members

		public int FourthMethod()
		{
			Console.WriteLine("FourthMethod called.");

			if (_plug1 != null)
				_plug1.SomeMethod();

			if (_plug2 != null)
				_plug2.SomeMethod2();

			return _dummy;
		}

		#endregion
	}
}
